package com.example.sdcarddet;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;


public class sdcardrece extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
	String action = intent.getAction();
		if(action.equals(Intent.ACTION_MEDIA_EJECT)){
		 Toast.makeText(context, "SDcard ACTION_MEDIA_EJECT",Toast.LENGTH_SHORT).show();
		}else if(action.equals(Intent.ACTION_MEDIA_MOUNTED)){
			
			try{
			 Toast.makeText(context, "SDcard ACTION_MEDIA_MOUNTED :"+intent.getData().toString() 
                     .substring("file://".length()),Toast.LENGTH_LONG).show();
			}
			catch (Exception e) {
				 Toast.makeText(context, "SDcard ACTION_MEDIA_MOUNTED ",Toast.LENGTH_SHORT).show();

 			}
		}
	}
	
}
